package com.xdb.sqlparser.dialect.mysql.ast.statement;

import com.xdb.sqlparser.ast.SQLExpr;
import com.xdb.sqlparser.ast.statement.SQLRollbackStatement;
import com.xdb.sqlparser.dialect.mysql.visitor.MySqlASTVisitor;
import com.xdb.sqlparser.visitor.SQLAstVisitor;
import com.xdb.util.JDBCConstants;

public class MySqlRollbackStatement extends SQLRollbackStatement implements MySqlStatement {

	private Boolean chain;
	private Boolean release;

	private SQLExpr force;

	public MySqlRollbackStatement() {
		super(JDBCConstants.MYSQL);
	}

	public Boolean getChain() {
		return chain;
	}

	public void setChain(Boolean chain) {
		this.chain = chain;
	}

	public Boolean getRelease() {
		return release;
	}

	public void setRelease(Boolean release) {
		this.release = release;
	}

	@Override
	protected void accept0(SQLAstVisitor visitor) {
		if (visitor instanceof MySqlASTVisitor) {
			accept0((MySqlASTVisitor) visitor);
		} else {
			throw new IllegalArgumentException("not support visitor type : " + visitor.getClass().getName());
		}
	}

	@Override
	public void accept0(MySqlASTVisitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, getTo());
			acceptChild(visitor, getForce());
		}

		visitor.endVisit(this);
	}

	public SQLExpr getForce() {
		return force;
	}

	public void setForce(SQLExpr force) {
		this.force = force;
	}

}
